<span id="${uuid}" style="display: none"></span>
<table data-id="grid"></table>
<div data-id="nsdb" style="padding: 5px; height: auto">
    <a href="${pageContext.request.contextPath}/app/api/message/toSearch" data-key="search" iconCls="fa fa-search fa-lg" plain="true">搜索</a>
    <a href="#" data-key="search_all" iconCls="fa fa-refresh fa-lg" plain="true">搜索全部</a>
</div>
<script type="text/javascript" language="javascript">
    (function ($) {
        var uuid = "${uuid}";
        var page = new $.PageDomFactory(uuid);
        var contextWindow = new $.PageWindow();

        var pageComponentList = new $.PageListComponent(uuid, {
            view: {
                grid: "grid",
                myToolbar: "nsdb"
            },
            configs: {
                gridTitle: "消息列表",
                gridUrl: '${pageContext.request.contextPath}/app/api/message/messageRange?messageId=${messageId}',
                gridColumns: [
                    {
                        field: 'id',
                        hidden: true
                    },
                    {
                        field: 'temp1',
                        hidden: true
                    },
                    {
                        field: 'receiver',
                        title: '接收人',
                        width: 200,
                        align: 'left'
                    },
                    {
                        field: 'readTime',
                        title: '阅读时间',
                        width: 200,
                        align: 'left',
                        formatter: function (value, rowData, rowIndex) {
                            if (value) {
                                return value;
                            } else {
                                return "<a>N/A</a>";
                            }
                        }
                    }
                ]
            },
            events: {
                renderColBarBefore: function () {
                    return true;
                },
                onClickToolbarBtn: function (context, btn) {
                    switch (btn.key) {
                        case "search_all":
                            context.searchAll();
                            break;
                        case "search":
                            context.search(btn.href, "消息搜索", "message_search");
                            break;
                        default :
                            break;
                    }
                }
            }
        });
    })(jQuery);
</script>